﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Threading;
using System.Windows.Forms;
using bll;

namespace TimeIt.beispiele
{
    public partial class customer : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            bll.clsUserCollection _UserCol = new bll.clsUserCollection();
            bll.clsUser _clsIdUser = new bll.clsUser();
            Int32 sessionId = bll.clsUser.Session;
            if (sessionId == 0) { Response.Redirect("login.aspx"); }
            _clsIdUser = _UserCol.GetUserNameBySessionId();
            UserName.Text = _clsIdUser.Title + " " + _clsIdUser.Name;
            UserName2.Text = _clsIdUser.Title + " " + _clsIdUser.Name;

            DateTime today = DateTime.Now;
            invoiceDate.Text = today.ToString("yyyy-MM-dd");

            bll.clsProjectCollection _ProjectCol = new bll.clsProjectCollection();
            bll.clsProject _clsProject = new bll.clsProject();
            _clsProject = _ProjectCol.GetCustomerDataById();
            firm.Text = _clsProject.Client;
            street.Text = _clsProject.Address;
            postCode.Text = _clsProject.Postcode;
            city.Text = _clsProject.Location;
            country.Text = _clsProject.Country;
            
            //costs.DataBind();
            //DataBind();
        }

        protected void CalculateCosts(object sender, EventArgs e)
        {
            bll.clsProjectCollection _ProjectCol = new bll.clsProjectCollection();
            bll.clsProject _clsProject = new bll.clsProject();
            _clsProject = _ProjectCol.GetCustomerDataById();
            costs.Text = Convert.ToString(bll.clsProject.AllCosts);
            costs2.Text = Convert.ToString(bll.clsProject.AllCosts2);
            //costs.DataBind();

            bll.clsProject.AllCosts = 0;
        }

        protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
        {
            if (Menu1.SelectedValue.Equals("first"))
                MultiView1.ActiveViewIndex = 0;
            if (Menu1.SelectedValue.Equals("second"))
                MultiView1.ActiveViewIndex = 1;
        }
    }
}